home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / dodge.swf / scripts / __Packages / ObjectList.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  963 b   |  56 lines

  1. class ObjectList
  2. {
  3.    var list;
  4.    var pos;
  5.    function ObjectList()
  6.    {
  7.       this.list = new Array();
  8.       this.pos = 0;
  9.    }
  10.    function add(o)
  11.    {
  12.       if(this.indexOf(o) < 0)
  13.       {
  14.          this.list[this.pos] = o;
  15.          this.pos = this.pos + 1;
  16.       }
  17.    }
  18.    function ┬ºget┬º(index)
  19.    {
  20.       return this.list[index];
  21.    }
  22.    function remove(o)
  23.    {
  24.       var _loc2_ = this.indexOf(o);
  25.       if(_loc2_ >= 0)
  26.       {
  27.          this.list[_loc2_] = this.list[--this.pos];
  28.       }
  29.    }
  30.    function getLength()
  31.    {
  32.       return this.pos;
  33.    }
  34.    function size()
  35.    {
  36.       return this.pos;
  37.    }
  38.    function indexOf(o)
  39.    {
  40.       var _loc2_ = 0;
  41.       while(_loc2_ < this.list.length)
  42.       {
  43.          if(o == this.list[_loc2_])
  44.          {
  45.             return _loc2_;
  46.          }
  47.          _loc2_ = _loc2_ + 1;
  48.       }
  49.       return -1;
  50.    }
  51.    function toArray()
  52.    {
  53.       return this.list;
  54.    }
  55. }
  56.